import * as utils from '@/utils/h5'
import * as auth from '@/utils/auth'

export const getShareUrl = (options) => {
  const o = utils.deep(options)
  o.query = o.query || {}
  o.query.isShare = '1'
  //   const userInfo = auth.getLocUserInfo() || {}
  //   o.query.uId = userInfo.shareKey || ''
  o.query.account = auth.getLocAccount()
  o.query.password = auth.getPwd()
  const queryStr = utils.obj2Param(o.query || {})
  const sy = o.link.includes('?') ? '&' : '?'
  let link = o.link + sy + queryStr
  link = utils.encodeQuery(link)
  o.link = '?shareUrl=' + link
  o.allUrl = utils.getBaseUrl() + o.link
  console.log('getShareUrl', utils.decodeQuery(o.link))
  return o
}
